/**
 * 
 */
package xiaojian.toolkit.bean.xip.core;

import xiaojian.toolkit.bean.xip.annotation.SsipField;

/**
 * @author isdom
 * 
 */
public class SsipResponse extends AbstractSsipSignal implements XipResponse {

	@SsipField(index = 0, description = "错误码")
	private int errorCode;

	@SsipField(index = 1, description = "在所有响应包中，当errorCode=0时返回errorCode及其他定义的数据；当errorCode!=0时仅仅返回errorCode和errorMsg,’\\0’结尾")
	private String errorMessage;

	// public static <T extends SsipResponse> T createRespForError(Class<T>
	// clazz, XipProtocol protocol, int errorCode, String errorMessage) {
	// T resp;
	// try {
	// resp = clazz.newInstance();
	// } catch (InstantiationException e) {
	// e.printStackTrace();
	// return null;
	// } catch (IllegalAccessException e) {
	// e.printStackTrace();
	// return null;
	// }
	//
	// ((SsipResponse)resp).setErrorCode(errorCode);
	// ((SsipResponse)resp).setErrorMessage(errorMessage);
	// ((SsipResponse)resp).setXipProtocol(protocol);
	//
	// return resp;
	// }
	//

	/**
	 * @return the errorCode
	 */
	public int getErrorCode() {
		return errorCode;
	}

	/**
	 * @param errorCode
	 *            the errorCode to set
	 */
	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}

	/**
	 * @return the errorMessage
	 */
	public String getErrorMessage() {
		return errorMessage;
	}

	/**
	 * @param errorMessage
	 *            the errorMessage to set
	 */
	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}
}
